
package basic;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;


public class DateReader {
    
    private final static String dateFormat = "dd/MM/yyyy";
    private final static SimpleDateFormat format = new SimpleDateFormat(dateFormat);
    private final static Scanner in = new Scanner(System.in);
    
    
    public static Date readDate() throws Exception {
        System.out.println("format is: "+dateFormat.toLowerCase());
        String entered = in.next();
        try {
            Date output = format.parse(entered);
            return output;
        } catch (ParseException e){
            throw e;
        }
              
    }
    
}
